<?php
class m_kelas extends CI_Model
{
	public $table = 'kelas';
	public $primary_key = 'kl_id';
	
	function get_data(){
		$this->db->select('*');
		$this->db -> from($this->table);

		$query = $this -> db -> get();
		
		return $query->result();		
	}
	
	function get_data_by_id($id){
		$this->db->select('*');
		$this->db -> from($this->table);
		$this -> db -> where($this->primary_key, $id);

		$query = $this -> db -> get();
		
		return $query->row();		
	}
	
	function insert($value){
		return $this->db->insert($this->table, $value);
	}
	
	function update($value, $where){
		return $this->db->update($this->table, $value, $where);
	}
	
	function delete($where){
		return $this->db->delete($this->table, $where);
	}
}
?>